﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Ad_HoaDonUC.ascx.cs"
    Inherits="GUI.Admin.uc.Ad_HoaDonUC" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<script src="../js/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">

    //

    function LoadSTT() {
        alert('ContentPlaceHolder1_Ad_HoaDonUC1_GridViewChiTietHoaDon action !!!');
    }

</script>
<!--Panel danh sách hóa đơn-->
<style type="text/css">
    .gia
    {
        text-align: right;
    }
    
    .style1
    {
        width: 25%;
    }
    
    .style2
    {
        color: Blue;
        font-size: 25px;
        margin-left: 50px;
    }
    
    .style3
    {
        color: Red;
        font-size: medium;
    }
    
    .style4
    {
        color: #FF0000;
    }
    
    .tb_left
    {
        width: 15%;
    }
    
    .tb_center
    {
        width: 10%;
    }
    
    .tb_right
    {
        width: 75%;
    }
    
    .image_format
    {
        vertical-align: bottom;
        cursor: pointer;
    }
</style>
<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <center>
            <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                <ProgressTemplate>
                    <img src="images/loading.gif" alt="" />
                </ProgressTemplate>
            </asp:UpdateProgress>
        </center>--%>
<asp:Panel ID="PanelDanhSachHoaDon" runat="server">
    <table style="width: 100%; border: 1px solid #008000;">
        <tr>
            <td class="style1">
                <asp:ImageButton ID="ImageButtonTroLai" runat="server" ImageUrl="~/Admin/images/back_f2.png"
                    OnClick="ImageButtonTroLai_Click" ToolTip="Trở lại" Style="width: 18px" />
                <span class="style2">Danh sách hóa đơn </span>
            </td>
            <td class="style1">
                &nbsp;
            </td>
            <td class="style1">
                <span class="style4">Tổng số hóa đơn: </span>&nbsp;
                <asp:Label ID="LabelTongSoHoaDon" runat="server" Text="" CssClass="style3">
                </asp:Label>
            </td>
            <td width="10%">
                &nbsp;
            </td>
            <td width="10%">
                &nbsp;
            </td>
            <td width="5%">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                Từ ngày : &nbsp;
                <eo:DatePicker ID="DatePickerTuNgay" runat="server" ControlSkinID="None" DayCellHeight="16"
                    DayCellWidth="19" DisabledDates="" FirstMonth="2010-07-01" MinValidDate="2010-01-01"
                    OtherMonthDayVisible="True" PickerFormat="dd/MM/yyyy hh:mm:ss tt" SelectedDates=""
                    TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon"
                    VisibleDate="2012-02-01" Width="250px" MaxValidDate="9998-12-31">
                    <TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
                    <SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                    <DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                    <PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;" />
                    <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
                    <TitleArrowStyle CssText="cursor:hand" />
                    <DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
                    <MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
                    <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
                    <OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                    <DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
                    <DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                </eo:DatePicker>
            </td>
            <td>
                Đến ngày : &nbsp;
                <eo:DatePicker ID="DatePickerDenNgay" runat="server" ControlSkinID="None" DayCellHeight="16"
                    DayCellWidth="19" DisabledDates="" FirstMonth="2010-07-01" MinValidDate="2010-01-01"
                    OtherMonthDayVisible="True" PickerFormat="dd/MM/yyyy hh:mm:ss tt" SelectedDates=""
                    TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon"
                    VisibleDate="2012-02-01" Width="250px" MaxValidDate="9998-12-31">
                    <TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
                    <SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                    <DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                    <PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;" />
                    <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
                    <TitleArrowStyle CssText="cursor:hand" />
                    <DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
                    <MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
                    <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
                    <OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                    <DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
                    <DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                </eo:DatePicker>
            </td>
            <td>
                <asp:Button ID="ButtonThongKe" CssClass="button_thuchien" Text="Thống kê" ToolTip="Thống kê"
                    runat="server" OnClick="ButtonThongKe_Click" />
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="6">
                <asp:GridView ID="GridViewHoaDon" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    CellPadding="4" ForeColor="#333333" Width="100%" EnableModelValidation="True"
                    OnPageIndexChanging="GridViewHoaDon_PageIndexChanging" OnRowDataBound="GridViewHoaDon_RowDataBound"
                    OnRowCommand="GridViewHoaDon_RowCommand" OnRowDeleting="GridViewHoaDon_RowDeleting">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButtonXoa" runat="server" CommandName="Delete" ImageUrl="~/Admin/images/delete.png"
                                    ToolTip="Hủy hóa đơn này" OnClientClick="return confirm('Bạn có muốn hủy hóa đơn này không? Lưu ý: thao tác này sẽ xóa bỏ hóa đơn này trong hệ thống và không thể phục hồi lại!');" />
                            </ItemTemplate>
                            <HeaderStyle Width="20px" />
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButtonActive" runat="server" CommandName="Active" ImageUrl="~/Admin/images/Active_2.png"
                                    Width="18px" Height="18px" OnClientClick="return confirm('Bạn có muốn cập nhật tình trạng hóa đơn này không?');"
                                    ToolTip="Cập nhật tình trạng hóa đơn này" CommandArgument='<%# Eval("MaHoaDon") %>' />
                            </ItemTemplate>
                            <HeaderStyle Width="20px" />
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButtonChiTiet" runat="server" CommandName="View" ImageUrl="~/Admin/images/generic.png"
                                    Width="18px" Height="18px" ToolTip="Xem thông tin chi tiết hóa đơn này" CommandArgument='<%# Eval("MaHoaDon") %>' />
                            </ItemTemplate>
                            <HeaderStyle Width="20px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Mã hóa đơn">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaHoaDon" runat="server" Text='<%# Eval("MaHoaDon") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Khách hàng">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaKhachHang" runat="server" Text='<%# LoadKhachHang(Eval("MaKhachHang")) %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="120px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Người nhận">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaNguoiNhanHang" runat="server" Text='<%# LoadNguoiNhanHang(Eval("MaNguoiNhanHang")) %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="120px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Nhân viên lập">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaNhanVien" runat="server" Text='<%# LoadNhanVien(Eval("MaNhanVien")) %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày lập hóa đơn">
                            <ItemTemplate>
                                <asp:Label ID="LabelNgayLapHoaDon" runat="server" Text='<%# LoadFullDateTime(Eval("NgayLapHoaDon")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày giao">
                            <ItemTemplate>
                                <asp:Label ID="LabelNgayGiao" runat="server" Text='<%# LoadFullDateTime(Eval("NgayGiao")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Hình thức giao hàng">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaHinhThucGiaoHang" runat="server" Text='<%# LoadHinhThucGiaoHang(Eval("MaHinhThucGiaoHang")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Hình thức thanh toán">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaHinhThucThanhToan" runat="server" Text='<%# LoadHinhThucThanhToan(Eval("MaHinhThucThanhToan")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Khu vực giao hàng">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaKhuVucGiaoHang" runat="server" Text='<%# LoadKhuVucGiaoHang(Eval("MaKhuVucGiaoHang")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Phí giao hàng">
                            <ItemTemplate>
                                <asp:Label ID="LabelPhiGiaoHang" runat="server" Text='<%# Eval("PhiGiaoHang", "{0:0,0}")%>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tổng tiền (VNĐ)">
                            <ItemTemplate>
                                <asp:Label ID="LabelTongTien" CssClass="gia" runat="server" Text='<%# Eval("TongTien","{0:0,0}") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="VAT">
                            <ItemTemplate>
                                <asp:Label ID="LabelVAT" CssClass="gia" runat="server" Text='<%# Eval("VAT") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="50px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tổng tiền thanh toán (VNĐ)">
                            <ItemTemplate>
                                <asp:Label ID="LabelTongTienThanhToan" CssClass="gia" runat="server" Text='<%# Eval("TongTienThanhToan","{0:0,0}") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tình trạng">
                            <ItemTemplate>
                                <asp:Label ID="LabelTinhTrang" runat="server" Text='<%# LoadTinhTrang(Eval("TinhTrangHoaDon")) %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="80px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ghi chú">
                            <ItemTemplate>
                                <asp:Label ID="LabelGhiChu" runat="server" Text='<%# Eval("GhiChu") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="80px" />
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
            </td>
        </tr>
    </table>
</asp:Panel>
<asp:Panel ID="PanelChiTietHoaDon" runat="server">
    <table style="width: 100%; border: 1px solid #008000;">
        <tr>
            <td>
                <span class="style2">Thông tin chi tiết hóa đơn </span>
            </td>
            <td>
                <asp:HiddenField ID="HiddenFieldMaHoaDon" runat="server" Visible="False" />
            </td>
            <td class="style1">
                <span class="style3">Tổng tiền: </span>&nbsp;
                <asp:Label ID="LabelTongTien" runat="server" Text="" CssClass="style3">
                </asp:Label>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="6">
                <asp:GridView ID="GridViewChiTietHoaDon" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    CellPadding="4" ForeColor="#333333" Width="100%"
                    OnRowDataBound="GridViewChiTietHoaDon_RowDataBound" 
                    OnPageIndexChanging="GridViewChiTietHoaDon_PageIndexChanging">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <%-- <asp:TemplateField HeaderText="STT">
                            <ItemTemplate>
                                <asp:Label ID="LabelSTT" runat="server" Text=''></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="50px" />
                        </asp:TemplateField>--%>
                        <%-- <asp:TemplateField HeaderText="ID">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaChiTietHoaDon" runat="server" Text='<%# Eval("MaChiTietHoaDon") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="50px" />
                        </asp:TemplateField>--%>
                        <asp:TemplateField HeaderText="Mã hóa đơn">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaHoaDon" runat="server" Text='<%# Eval("MaHoaDon") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Sản phẩm">
                            <ItemTemplate>
                                <asp:Label ID="LabelMaSanPham" runat="server" Text='<%# LoadSanPham(Eval("MaSanPham")) %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Số lượng">
                            <ItemTemplate>
                                <asp:Label ID="LabelSoLuong" runat="server" Text='<%# Eval("SoLuong") %>' 
                                    style="text-align: center"></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Đơn giá (VNĐ)">
                            <ItemTemplate>
                                <asp:Label ID="LabelDonGia" runat="server" 
                                    Text='<%# Eval("DonGia","{0:0,0}") %>' style="text-align: right"></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                            <ItemStyle HorizontalAlign="Right" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Thành tiền (VNĐ)">
                            <ItemTemplate>
                                <asp:Label ID="LabelThanhTien" runat="server" 
                                    Text='<%# LoadThanhTien(Eval("SoLuong"),Eval("DonGia")) %>' 
                                    style="text-align: right"></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                            <ItemStyle HorizontalAlign="Right" />
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
            </td>
        </tr>
    </table>
</asp:Panel>
<%--   </ContentTemplate>
</asp:UpdatePanel>--%>
